/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.uniquery.controller;

import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.common.documentdataload.dto.CaseDataQueryDto;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.*;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.ICaseMainInfoService;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.*;
import com.icinfo.cloud.provider.punish.uniquery.dto.UniQueryDto;
import com.icinfo.cloud.provider.punish.uniquery.vo.UniQueryWorkTaskColorsVo;
import com.icinfo.cloud.provider.punish.uniquery.vo.UniQueryWorkTaskVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * 【V1.11.1】 描述: 案件各类查询优化
 *
 * @author tianrunjia
 * @date 2023-03-05
 */
@RestController
@RefreshScope
@RequestMapping("/punish/uniquery")
@Slf4j
public class UnifiedQueryController extends BaseController {

    @Autowired
    private ICaseMainInfoService caseMainInfoService;



    /**
     * 描述： 工作台--待办任务
     *
     * @author: tianrunjia
     * @date: 2023-03-06
     * @param: uniQueryDto
     * @return UniQueryWorkTaskVo
     **/
    @RequestMapping("/getWorkWaitTaskList")
    public Result<PageResponse<UniQueryWorkTaskVo>> getWorkWaitTaskList(@RequestBody UniQueryDto uniQueryDto) {
        List<UniQueryWorkTaskVo> uniQueryWorkTaskVoList = caseMainInfoService.getWorkWaitTaskList(uniQueryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(uniQueryWorkTaskVoList));
    }

    /**
     * 描述： 工作台--待办任务颜色
     *
     * @author: tianrunjia
     * @date: 2023/03/06
     * @param: uniQueryDto
     * @return {@link Result< ColorSumVo>}
     **/
    @RequestMapping("/getWorkWaitTaskListColors")
    public Result<UniQueryWorkTaskColorsVo> getWorkWaitTaskListColors(@RequestBody UniQueryDto uniQueryDto) {
        UniQueryWorkTaskColorsVo uniQueryWorkTaskColorsVo = caseMainInfoService.getWorkWaitTaskListColors(uniQueryDto);
        return Result.success(uniQueryWorkTaskColorsVo);
    }





















    /*@Resource
    private ICaseMainInfoService caseMainInfoService;

    *//**
     * 【V1.0.0】描述：获取案件详情数据
     *
     * @param queryDto {@link CaseDetailInfoQueryDto}
     * @return {@link Result <CaseMainDetailInfoVo>} 案件详情数据
     * @author xiangyuyu
     * @date 2022-02-16 16:02
     *//*
    @PostMapping("/getCaseDetailInfo")
    @ApiOperation(value = "【V1.0.0】描述：获取案件详情数据", httpMethod = "POST")
    public Result<CaseDetailInfoVo> getCaseDetailInfo(@RequestBody @Validated CaseDetailInfoQueryDto queryDto) {
        CaseDetailInfoVo vo = caseMainInfoService.getCaseDetailInfo(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }
    *//**
     * 根据案件阶段获取对应文书
     * @author liyafeng
     * @date 2022/8/3
      * @param queryDto
     * @return {@link Result< CaseDetailInfoVo>}
     *//*
    @PostMapping("/getCaseStageDocumentInfo")
    public Result<List<CaseStageDocumentInfoVo>> getCaseStageDocumentInfo(@RequestBody @Validated CaseStageDocumentQueryDto queryDto) {
        List<CaseStageDocumentInfoVo> vos = caseMainInfoService.getCaseStageDocumentInfo(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vos);
    }

    *//**
     * 【V1.0.0】描述：根据案件id查询案件主要信息
     *
     * @param caseId 案件id
     * @return {@link Result<CaseMainInfoVo>} 案件主要信息
     * @author xiangyuyu
     * @date 2022-02-22 09:33
     *//*
    @PostMapping("/getCaseMainInfo")
    @ApiOperation(value = "【V1.0.0】描述：根据案件id查询案件主要信息", httpMethod = "POST")
    public Result<CaseMainInfoVo> getCaseMainInfo(@RequestParam String caseId) {
        CaseMainInfoVo vo = caseMainInfoService.getCaseMainInfo(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }


    *//**
     * 【V1.0.0】描述：获取案件详情-当前阶段可操作的文书列表
     *
     * @param queryDto {@link CaseKeyInfoQueryDto}
     * @return {@link Result< List<CaseDetailOperateDocInfoVo> >} 案件详情-当前阶段可操作的文书列表
     * @author xiangyuyu
     * @date 2022-02-16 16:02
     *//*
    @PostMapping("/getCouldBeOperateDocListCurrentStage")
    @ApiOperation(value = "【V1.0.0】描述：获取案件详情-当前阶段可操作的文书列表", httpMethod = "POST")
    public Result<List<CaseDetailOperateDocInfoVo>> getCouldBeOperateDocListCurrentStage(@RequestBody @Validated CaseKeyInfoQueryDto queryDto) {
        List<CaseDetailOperateDocInfoVo> docList = caseMainInfoService.getCouldBeOperateDocListCurrentStage(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, docList);
    }
    *//**
     * 【V1.0.0】描述：工作台--代办任务列表+全部代办+办结案件
     *
     * @param caseDto 入参
     * @return Result<AuditVo>
     * @author lxj
     * @date 2022/2/18
     **//*
    @RequestMapping("/getApproveTaskList")
    public Result<PageResponse<TaskVo>> getApproveTaskList(@RequestBody @Validated CaseQueryDto caseDto) {
//       if("blue".equals(caseDto.getTimeColor())){
//            return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(null));
//        }
        caseDto.setUserId(caseDto.getUserId());
        List<TaskVo> list = caseMainInfoService.getApproveTaskList(caseDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(list));
    }

    *//**
     * 【V1.6.0】描述：办结案件-优化版
     *
     * @param caseDto 入参
     * @return List<AllFinishCaseInfoVo>
     * @author tianrunjia
     * @date 2022/11/01
     **//*
    @RequestMapping("/getAllFinishCaseInfoList")
    public Result<PageResponse<AllFinishCaseInfoVo>> getAllFinishCaseInfoList(@RequestBody @Validated CaseQueryDto caseDto) {
        System.out.println(System.currentTimeMillis());
        List<AllFinishCaseInfoVo> list = caseMainInfoService.getAllFinishCaseInfoList(caseDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(list));
    }

    *//**
     * 【V1.0.0】描述：工作台--代办任务数--分颜色统计
     *
     * @param caseDto
     * @return Result
     * @author lxj
     * @date 2022/2/22
     **//*
    @RequestMapping("/getColorStatistics")
    public Result<ColorSumVo> getColorStatistics(@RequestBody CaseQueryDto caseDto) {
        ColorSumVo colorSumVo = caseMainInfoService.getColorStatistics(caseDto);
        return Result.success(colorSumVo);
    }

    *//**
     * 描述： 工作台--代办任务列表(新)
     *
     * @author: zhengqiang
     * @date: 2022/10/12
     * @param: caseDto
     * @return {@link Result< PageResponse< TaskVo>>}
     **//*
    @RequestMapping("/getApproveTaskListNew")
    public Result<PageResponse<TaskVo>> getApproveTaskListNew(@RequestBody @Validated CaseQueryDto caseDto) {
        caseDto.setUserId(caseDto.getUserId());
        List<TaskVo> list = caseMainInfoService.getApproveTaskListNew(caseDto);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse<>(list));
    }

    *//**
     * 描述： 工作台--代办任务数--分颜色统计(新)
     *
     * @author: zhengqiang
     * @date: 2022/10/12
     * @param: caseDto
     * @return {@link Result< ColorSumVo>}
     **//*
    @RequestMapping("/getColorStatisticsNew")
    public Result<ColorSumVo> getColorStatisticsNew(@RequestBody CaseQueryDto caseDto) {
        ColorSumVo colorSumVo = caseMainInfoService.getColorStatisticsNew(caseDto);
        return Result.success(colorSumVo);
    }


    *//**
     * 【V1.0.0】描述：公用-根据案件id查询案件简要基础信息
     *
     * @param caseId 案件id
     * @return {@link Result< CaseBasicInfoVo >} 案件简要基础信息
     * @author xiangyuyu
     * @date 2022-02-22 09:33
     *//*
    @PostMapping("/getCaseBasicInfo")
    @ApiOperation(value = "【V1.0.0】描述：公用-根据案件id查询案件简要基础信息", httpMethod = "POST")
    public Result<CaseBasicInfoVo> getCaseBasicInfo(@RequestParam String caseId) {
        CaseBasicInfoVo vo = caseMainInfoService.getCaseBasicInfo(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    *//**
     * 【V1.0.0】描述：公用-根据案件id查询案件阶段流转记录信息（包含文书、附件）TODO 后续干掉
     *
     * @param caseId 案件id
     * @return {@link Result<List<CaseStageFlowRecordInfoVo> >} 案件流转记录信息（包含文书、附件）
     * @author xiangyuyu
     * @date 2022-02-22 20:15
     *//*
    @PostMapping("/getCaseStageFlowRecord")
    @ApiOperation(value = "【V1.0.0】描述：公用-根据案件id查询案件阶段流转记录信息（包含文书、附件）", httpMethod = "POST")
    public Result<List<CaseStageFlowRecordInfoVo>> getCaseStageFlowRecord(@RequestParam String caseId) {
        List<CaseStageFlowRecordInfoVo> caseStageFlowRecord = caseMainInfoService.getCaseStageFlowRecord(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseStageFlowRecord);
    }

    *//**
     * 【V1.0.0】描述：获取案件详情-阶段信息
     *
     * @param caseId 案件id
     * @return {@link Result<List< CaseDetailStageInfoVo > >} 案件详情-阶段信息
     * @author xiangyuyu
     * @date 2022-02-23 21:37
     *//*
    @PostMapping("/getCaseDetailStageInfo")
    @ApiOperation(value = "【V1.0.0】描述：获取案件详情-阶段信息", httpMethod = "POST")
    public Result<List<CaseDetailStageInfoVo>> getCaseDetailStageInfo(@RequestParam String caseId) {
        List<CaseDetailStageInfoVo> caseDetailStageInfoList = caseMainInfoService.getCaseDetailStageInfo(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseDetailStageInfoList);
    }

    *//**
     * 【V2.0.0】描述：获取案件当事人子流程信息
     *
     * @param caseId 案件id
     * @return {@link Result<List< CaseDetailStageInfoVo > >} 案件当事人子流程信息
     * @author xiangyuyu
     * @date 2022-05-28 20:08
     *//*
    @PostMapping("/getPartiesSubFlowInfo")
    @ApiOperation(value = "【V2.0.0】描述：获取案件当事人子流程信息", httpMethod = "POST")
    public Result<List<PartiesSubFlowInfoVo>> getPartiesSubFlowInfo(@RequestParam String caseId) {
        List<PartiesSubFlowInfoVo> list = caseMainInfoService.getPartiesSubFlowInfo(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, list);
    }


    *//**
     * 【V1.3.0】查询简易处罚案件详情
     *
     * @author: zhengqiang
     * @date: 2022/6/15
     * @param: queryDto
     * @return {@link Result< CaseDetailSimpleInfoVo>}
     **//*
    @PostMapping("/getCaseDetailSimpleInfo")
    public Result<CaseDetailSimpleInfoVo> getCaseDetailSimpleInfo(@RequestBody @Validated CaseDetailInfoQueryDto queryDto) {
        CaseDetailSimpleInfoVo vo = caseMainInfoService.getCaseDetailSimpleInfo(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    *//**
     * 【V1.3.0】描述：案件撤回某个处置环节操作
     *
     * @param caseId 案件id,caseLinkCode 案件环节编码
     * @return {@link Result<String> >}
     * @author tianrunjia
     * @date 2022-06-24
     *//*
    @GetMapping("/doRecallCaseHandleLink")
    @ApiOperation(value = "【V1.3.0】描述：案件撤回某个处置环节操作", httpMethod = "GET")
    public Result<String> doRecallCaseHandleLink(@RequestParam String caseId, String caseLinkCode){
        caseMainInfoService.doRecallCaseHandleLink(caseId,caseLinkCode);
        return Result.success(Constant.STRING_SUCCESS_EN, "撤回成功！");
    }


    *//**
     * 描述：校验案件是否处于不可操作状态
     *
     * @param caseId 案件id
     * @return Result<boolean> 案件是否处于不可操作状态(true-是/false-否)
     * @author xiangyuyu
     * @date 2022-06-01 22:13
     *//*
    @PostMapping("/validateCaseIsInNotDealStatus")
    @ApiOperation(value = "描述：校验案件是否处于不可操作状态", httpMethod = "POST")
    Result<Boolean> validateCaseIsInNotDealStatus(@RequestParam String caseId) {
        boolean flag = caseMainInfoService.validateCaseIsInNotDealStatus(null, caseId);
        return Result.success(flag);
    }

    *//**
     * 根据获取案件对应的送达及地址确认书编码
     * @author liyafeng
     * @date 2022/8/3
     * @param caseId
     * @return {@link String}
     *//*
    @PostMapping("/getCaseSendinfoConfirmCatalogCode")
    public Result<String> getCaseSendinfoConfirmCatalogCode(@RequestParam String caseId) {
        String caseSendinfoConfirmCatalogCode = caseMainInfoService.getCaseSendinfoConfirmCatalogCode(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseSendinfoConfirmCatalogCode);
    }

    *//**
     * 【V1.4.1】描述：案件按环节操作所需信息获取
     * @author tianrunjia
     * @date 2022-08-26
     *//*
    @PostMapping("/getCaseLinkOperateBusiInfo")
    @ApiOperation(value = "【V1.4.1】描述：案件按环节操作所需信息获取", httpMethod = "POST")
    public Result<CaseDetailOperateDocInfoVo> getCaseLinkOperateBusiInfo(@RequestBody @Validated CaseLinkOperateBusiInfoQueryDto queryDto) {
        CaseDetailOperateDocInfoVo vo = caseMainInfoService.doGetCaseLinkOperateBusiInfo(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    *//**
     * 【V1.4.1】描述：案件详情左边案件目录查询
     *
     * @param caseId 案件id
     * @author tianrunjia
     * @date 2022-08-27
     *//*
    @GetMapping("/getCaseDocumentCatalogChainInfos")
    @ApiOperation(value = "【V1.0.0】描述：案件详情左边案件目录查询", httpMethod = "Get")
    public Result<List<CaseDocumentCatalogChainInfoVo>> getCaseDocumentCatalogChainInfos(@RequestParam String caseId) {
        List<CaseDocumentCatalogChainInfoVo> caseDocumentCatalogChainInfoVos = caseMainInfoService.doGetCaseDocumentCatalogChainInfos(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, caseDocumentCatalogChainInfoVos);
    }
    *//**
     * 【V1.9.3】描述：待督办任务列表(提供给大综合接口-对接人阮洪斌)
     *
     * @param queryDto  查询对象
     * @author wuzhihui
     * @date 2022-12-01
     *//*
    @PostMapping("/getWaitingSupervisedTaskList")
    @ApiOperation(value = "【V1.9.3】描述：待督办任务列表(提供给大综合接口-对接人阮洪斌)", httpMethod = "POST")
    public Result<PageResponse<WaitingSupervisedTaskVo>> getWaitingSupervisedTaskList(@RequestBody @Validated WaitingSupervisedTaskQueryDto queryDto) {
        List<WaitingSupervisedTaskVo> waitingSupervisedTaskVos = caseMainInfoService.getWaitingSupervisedTaskList(queryDto);
        return Result.success(new PageResponse<>(waitingSupervisedTaskVos));
    }
    *//**
     * 【V1.9.3】描述：待督办任务信息(提供给大综合接口-对接人阮洪斌)
     *
     * @param caseId 案件ID
     * @author wuzhihui
     * @date 2022-12-01
     *//*
    @GetMapping("/getWaitingSupervisedTask")
    @ApiOperation(value = "【V1.9.3】描述：待督办任务信息(提供给大综合接口-对接人阮洪斌)", httpMethod = "GET")
    public Result<WaitingSupervisedTaskDetailVo> getWaitingSupervisedTask(@RequestParam String caseId) {
        WaitingSupervisedTaskDetailVo waitingSupervisedTaskVo = caseMainInfoService.getWaitingSupervisedTask(caseId);
        return Result.success(waitingSupervisedTaskVo);
    }
    *//**
     * 【V1.9.3】描述：获取待督办需要通知浙政钉的用户id(提供给大综合接口-对接人阮洪斌)
     *
     * @param caseId 案件ID
     * @author wuzhihui
     * @date 2022-12-01
     *//*
    @GetMapping("/getWaitingSupervisedRelUserIdList")
    @ApiOperation(value = "【V1.9.3】描述：获取待督办需要通知浙政钉的用户id(提供给大综合接口-对接人阮洪斌)", httpMethod = "GET")
    public Result<Set<String>> getWaitingSupervisedRelUserIdList(@RequestParam String caseId) {
        Set<String> userIdList = caseMainInfoService.getWaitingSupervisedRelUserIdList(caseId);
        return Result.success(userIdList);
    }

    *//**
     * 描述：统一案件分页查询列表
     * @author yehuafei
     * @date 2022-12-05
     *//*
    @PostMapping("/getCaseInfoPage")
    @ApiOperation(value = "描述：统一案件分页查询列表", httpMethod = "POST")
    public Result<PageResponse<CaseInfoPageResponse>> getCaseInfoPage(@RequestBody @Validated CaseInfoPageRequest request) {
        List<CaseInfoPageResponse> list = caseMainInfoService.getCaseInfoList(request);
        return Result.success(Constant.STRING_GET_SUCCESS, new PageResponse(list));
    }
    *//**
     * 描述：统一案件分页查询统计
     * @author yehuafei
     * @date 2022-12-05
     *//*
    @GetMapping("/getCaseInfoPageStatistics")
    @ApiOperation(value = "描述：统一案件分页查询列表", httpMethod = "GET")
    public Result<CaseInfoPageResponseStatistics> getCaseInfoPageStatistics() {
        CaseInfoPageResponseStatistics statistics = caseMainInfoService.getCaseInfoStatistics();
        return Result.success(Constant.STRING_GET_SUCCESS, statistics);
    }

    *//**
     * 描述：统一案件颜色查询统计
     * @author yehuafei
     * @date 2022-12-05
     *//*
    @PostMapping("/getCaseInfoPageColorStatistics")
    @ApiOperation(value = "描述：统一案件分页查询列表", httpMethod = "POST")
    public Result<CaseInfoPageColorResponseStatistics> getCaseInfoPageColorStatistics() {
        CaseInfoPageColorResponseStatistics statistics = caseMainInfoService.getCaseInfoPageColorStatistics();
        return Result.success(Constant.STRING_GET_SUCCESS, statistics);
    }

    *//**
     * 描述：统一案件详情
     * @author yehuafei
     * @date 2022-12-05
     *//*
    @GetMapping("/getCaseInfoDetail")
    @ApiOperation(value = "描述：统一案件分页查询列表", httpMethod = "GET")
    public Result<CaseInfoDetailResponse> getCaseInfoDetail(@RequestParam("id") String id) {
        CaseInfoDetailResponse caseInfoDetail = caseMainInfoService.getCaseInfoDetail(id);
        return Result.success(Constant.STRING_GET_SUCCESS, caseInfoDetail);
    }

    *//**
     * 描述：统一案件详情  历史行政处罚记录
     * @author yehuafei
     * @date 2022-12-05
     *//*
    @PostMapping("/getCaseInformHisXZCFRecord")
    @ApiOperation(value = "描述：统一案件详情  历史行政处罚记录", httpMethod = "POST")
    public Result<PageResponse<CaseInformHisXZCFRecord>> getCaseInformHisXZCFRecord(@RequestBody CaseInformHisXZCFRecordRequest request) {
        List<CaseInformHisXZCFRecord> list = caseMainInfoService.getCaseInformHisXZCFRecord(request);
        return Result.success("查询成功",new PageResponse(list));
    }

    *//**
     * 【V1.0.0】描述：根据案件id获取加处罚款决定书填充信息
     *
     * @param queryDto 案件id
     * @return {@link Result<JCFKJDSDocData>} 案件主要信息
     * @author yehuafei
     * @date 2022-12-13 09:33
     *//*
    @PostMapping("/getJCFKJDSDocData")
    @ApiOperation(value = "【V1.0.0】描述：根据案件id查询案件主要信息", httpMethod = "POST")
    public Result<JCFKJDSDocData> getJCFKJDSDocData(@RequestBody @Validated CaseDataQueryDto queryDto) {
        JCFKJDSDocData data = caseMainInfoService.getJCFKJDSDocData(queryDto.getCaseId(),queryDto.getPartyId());
        return Result.success(Constant.STRING_GET_SUCCESS, data);
    }*/
}
